package binaryTreeNode;

import java.util.ArrayList;
import java.util.List;

public class InorderTraversal {
    public static void main(String[] args){
        TreeNode root = new TreeNode(1);
        root.right = new TreeNode(2);
        root.right.left = new TreeNode(3);
        System.out.println(inorderTraversal(root));
    }
    public static List<Integer> inorderTraversal(TreeNode root) {
        List<Integer> list =new ArrayList<>();

        if(root == null)
            return list;
        list.addAll(inorderTraversal(root.left)) ;
        list.add(root.val);
        list.addAll(inorderTraversal(root.right));
        return list;
    }
}
